Skip to content

ref(cells): Remove the legacy org invite route#112135

Closed
lynnagara wants to merge 3 commits intomasterfrom
lynnagara/ref/remove-dead-no-org-invite-route
Closed

ref(cells): Remove the legacy org invite route#112135
lynnagara wants to merge 3 commits intomasterfrom
lynnagara/ref/remove-dead-no-org-invite-route

Conversation

@lynnagara
Copy link
Copy Markdown
Member

@lynnagara lynnagara commented Apr 2, 2026

this removes the pre-silo organization invite path.

this fundamentally does not work in the regional or cell world -- all org specific routes need to contain the org identifier (id or slug) in order to target the correct cell.

since we have not sent invites using this legacy path for many years, it should be safe to remove. all invites use the properly org-scopedsentry-api-0-organization-accept-organization-invite instead

this is a prerequisite to #112053 and other codebase cleanups

it depends on #112137 and some other frontend changes that need to happen first

this removes the pre-silo organization invite path.

this fundamentally does not work in the regional or cell world
-- all org specific routes need to contain the org identifier
(id or slug) in order to target the correct cell.

since we have not sent invites using this path for many years, it
should be safe to remove

this is a prequisite to #112053
and other codebase cleanups
@lynnagara lynnagara requested a review from a team April 2, 2026 18:56
@lynnagara lynnagara requested a review from a team as a code owner April 2, 2026 18:56
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 2, 2026
@getsantry getsantry bot requested a review from a team as a code owner April 2, 2026 18:58
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

Comment thread src/sentry/api/urls.py
Comment on lines 3792 to 3795
name="sentry-api-0-data-export-notifications",
),
re_path(
r"^accept-invite/(?P<member_id>[^/]+)/(?P<token>[^/]+)/$",
AcceptOrganizationInvite.as_view(),
name="sentry-api-0-accept-organization-invite",
),
re_path(
r"^notification-defaults/$",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The removal of a legacy API invite endpoint is incomplete. Frontend code and backend tests still reference the deleted route, which will break user-facing functionality and CI tests.
Severity: HIGH

Suggested Fix

Update the frontend component in static/app/views/acceptOrganizationInvite/index.tsx to remove the conditional logic that calls the old endpoint, ensuring it always uses the new, organization-specific invite URL. Also, update the corresponding test file tests/sentry/api/endpoints/test_accept_organization_invite.py to remove references to the deleted route name sentry-api-0-accept-organization-invite.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/sentry/api/urls.py#L3792-L3795

Potential issue: The pull request removes the legacy API route
`/api/0/accept-invite/{memberId}/{token}/`, named
`sentry-api-0-accept-organization-invite`. However, the frontend code in
`static/app/views/acceptOrganizationInvite/index.tsx` was not updated and will still
attempt to call this removed endpoint for users on older invite links that lack an
organization slug. This will cause a 404 error, breaking the invitation acceptance flow
for those users. Additionally, backend tests in
`tests/sentry/api/endpoints/test_accept_organization_invite.py` still reference the
removed route name via `reverse()`, which will cause `NoReverseMatch` errors and break
the CI pipeline.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread src/sentry/api/urls.py
DataExportNotificationsEndpoint.as_view(),
name="sentry-api-0-data-export-notifications",
),
re_path(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed URL route still referenced in test helpers

High Severity

The deleted URL route named sentry-api-0-accept-organization-invite is still referenced in tests/sentry/api/endpoints/test_accept_organization_invite.py — in _get_paths() (line 39), _get_urls() (line 52), and a direct reverse() call (line 208). These helpers are used by nearly every test in AcceptInviteTest, so removing the route without updating the tests will cause NoReverseMatch failures across the entire test class.

Fix in Cursor Fix in Web

Comment thread src/sentry/api/urls.py
DataExportNotificationsEndpoint.as_view(),
name="sentry-api-0-data-export-notifications",
),
re_path(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backend route removal breaks frontend invite fallback path

Medium Severity

The removed accept-invite/{member_id}/{token}/ API route is still called by the frontend component AcceptOrganizationInvite in static/app/views/acceptOrganizationInvite/index.tsx. When orgSlug is null (no orgId in URL params and no customer domain), both the useApiQuery GET (line 227) and the useMutation POST (line 246, constructed via string interpolation, not getApiUrl) will hit the now-removed endpoint, resulting in 404 errors. The web route sentry-accept-invite in web/urls.py still exists and renders this component, so this path is still reachable.

Fix in Cursor Fix in Web

@lynnagara
Copy link
Copy Markdown
Member Author

looks like this route is still used so there are some dependencies that need to be done first - we need to reomve it from the frontend and stop sending users to the old route

first step: #112137

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Backend Test Failures

Failures on ab6c73c in this run:

tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_can_accept_while_authenticatedlog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:255: in test_can_accept_while_authenticated
    path = self._get_path(url, [om.id, om.token])
tests/sentry/api/endpoints/test_accept_organization_invite.py:58: in _get_path
    return reverse(url, args=args)
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_cannot_accept_when_user_needs_2falog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:399: in test_cannot_accept_when_user_needs_2fa
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_multi_region_organizationmember_idlog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:183: in test_multi_region_organizationmember_id
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_member_already_existslog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:329: in test_member_already_exists
    path = self._get_path(url, [om.id, om.token])
tests/sentry/api/endpoints/test_accept_organization_invite.py:58: in _get_path
    return reverse(url, args=args)
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_user_has_2falog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:221: in test_user_has_2fa
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_can_accept_when_user_has_2falog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:370: in test_can_accept_when_user_has_2fa
    path = self._get_path(url, [om.id, om.token])
tests/sentry/api/endpoints/test_accept_organization_invite.py:58: in _get_path
    return reverse(url, args=args)
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_cannot_accept_unapproved_invitelog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:306: in test_cannot_accept_unapproved_invite
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_invalid_member_idlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:82: in test_invalid_member_id
    for path in self._get_paths([1, 2]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_invalid_tokenlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:90: in test_invalid_token
    for path in self._get_paths([om.id, 2]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_2fa_cookie_deleted_after_acceptlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:422: in test_2fa_cookie_deleted_after_accept
    path = self._get_path(url, [om.id, om.token])
tests/sentry/api/endpoints/test_accept_organization_invite.py:58: in _get_path
    return reverse(url, args=args)
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_invite_not_pendinglog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:97: in test_invite_not_pending
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_user_can_use_ssolog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:235: in test_user_can_use_sso
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_invite_unapprovedlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:108: in test_invite_unapproved
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_multi_region_organizationmember_id__non_monolithlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:208: in test_multi_region_organizationmember_id__non_monolith
    reverse("sentry-api-0-accept-organization-invite", args=[om.id, om.token])
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_needs_authenticationlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:116: in test_needs_authentication
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_cannot_accept_expiredlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:287: in test_cannot_accept_expired
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_not_needs_authenticationlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:127: in test_not_needs_authentication
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_user_needs_2falog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:142: in test_user_needs_2fa
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.

Comment thread src/sentry/api/urls.py
Comment on lines 3783 to 3786
name="sentry-api-0-data-export-notifications",
),
re_path(
r"^accept-invite/(?P<member_id>[^/]+)/(?P<token>[^/]+)/$",
AcceptOrganizationInvite.as_view(),
name="sentry-api-0-accept-organization-invite",
),
re_path(
r"^notification-defaults/$",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The backend route for legacy organization invites (/accept-invite/.../) is removed, but the frontend still has fallback logic that calls this endpoint, leading to a 404 error.
Severity: MEDIUM

Suggested Fix

The frontend code in static/app/views/acceptOrganizationInvite/index.tsx should be updated to remove the fallback logic that calls the legacy /accept-invite/.../ endpoint. Alternatively, revert the removal of the backend route until the corresponding frontend changes are merged. The associated test in index.spec.tsx that validates this legacy behavior should also be removed or updated.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/sentry/api/urls.py#L3783-L3786

Potential issue: This pull request removes the legacy backend API route
`sentry-api-0-accept-organization-invite` at
`/accept-invite/(?P<member_id>[^/]+)/(?P<token>[^/]+)/`. However, the frontend component
`acceptOrganizationInvite` still contains fallback logic that attempts to call this
removed endpoint. This occurs when a user accesses a legacy invite link without an
organization slug (e.g., `/accept/:memberId/:token/`). The frontend will render, but the
subsequent API call will fail with a 404 error, showing the user a generic "invalid
link" message instead of properly handling the invite. The frontend changes to remove
this dependency were not included in this PR.

@lynnagara
Copy link
Copy Markdown
Member Author

superceded by #112513 -- temporary redirect needed

@lynnagara lynnagara closed this Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant